import React, { Component } from 'react';
import { Card, Button, Table, Form } from 'antd';
import axios from '../../axios';
import Utils from '../../utils/utils';
const FormItem = Form.Item;
export default class Order extends Component{
	state={}
	page={
		params: 1
	}
	componentDidMount(){
		this.requestList()
	}
	//默认数据接口
	requestList = ()=>{
        let _this = this;
        axios.ajax({
            url:'/order/list',
            data:{
                params: this.params
            }
        }).then((res)=>{
            let list = res.result.item_list.map((item, index) => {
                item.key = index;
                return item;
            });
            this.setState({
                list,
                pagination: Utils.pagination(res, (current) => {
                    _this.params.page = current;
                    _this.requestList();
                })
            })
        })
    }
	render(){
		const columns=[{
			title: '订单编号',
			dataIndex: 'order_sn'
		},
		{
			title: '车辆编号',
			dataIndex: 'bike_sn'
		},
		{
			title: '用户名',
			dataIndex: 'user_name'
		},
		{
			title: '手机号',
			dataIndex: 'mobile'
		},
		{
			title: '里程',
			dataIndex: 'distance'
		},
		{
			title: '行驶时长',
			dataIndex: 'total_time'
		},{
			title: '状态',
			dataIndex: 'status'
		},{
			title: '开始时间',
			dataIndex: 'start_time'
		},{
			title: '结束时间',
			dataIndex: 'end_time'
		},{
			title: '订单金额',
			dataIndex: 'total_fee'
		},{
			title: '实付金额',
			dataIndex: 'user_pay'
		}]
		return(
			<div>
				<Card></Card>
				<Card>
					<Button type="primary">订单详情</Button>
					<Button type="primary">结束订单</Button>
				</Card>
				<div>
					<Table
						bordered
						columns={columns}
						dataSource={this.state.list}
						pagination={this.state.pagination}
					 />
				</div>
			</div>
		);
	}
}